<template>


<div>


    <mt-header title="登录">
    </mt-header>
    <mt-field label="用户名" v-model="name"  placeholder="请输入用户名"></mt-field>
    <mt-field label="密码"  v-model="password" placeholder="请输入密码" type="password" ></mt-field>
    <div style="text-align: center">
    <mt-button style="margin-top: 5rem" v-on:click="check" type="primary"  class="inputCass">登录</mt-button>
    </div>
</div>
</template>

<script>
  // import store from '@/store/store'
  export  default {
    data(){
      return {

          name:"",
          password:""

      }

    },
    methods:{
      check:function (event) {
        if(this.name == '' || this.password == ''){
          this.$toast({
            message: '请输入用户名密码'
          });
          return;
        }
        let tempUserInfo={
          name:'admin',
          password:"123456",
          token:"1312",
          role:"admin"
        };
        this.$store.commit('setUserFn', { data: tempUserInfo });
        this.$router.push({path: '/index/homePage'})
      }
    }
  }
</script>

<style scoped>
.inputCass{
  width: 90%;
}


</style>
